package entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Juan Leal
 */
@Entity
@Table(name = "taxis")
@NamedQueries({
    @NamedQuery(name = "Taxi.findAll", query = "SELECT t FROM Taxi t"),
    @NamedQuery(name = "Taxi.findByNTaxi", query = "SELECT t FROM Taxi t WHERE t.nTaxi = :nTaxi"),
    @NamedQuery(name = "Taxi.findByKmLt", query = "SELECT t FROM Taxi t WHERE t.kmLt = :kmLt"),
    @NamedQuery(name = "Taxi.findByNombreConductor", query = "SELECT t FROM Taxi t WHERE t.nombreConductor = :nombreConductor"),
    @NamedQuery(name = "Taxi.findByModeloUnidad", query = "SELECT t FROM Taxi t WHERE t.modeloUnidad = :modeloUnidad"),
    @NamedQuery(name = "Taxi.findByAnio", query = "SELECT t FROM Taxi t WHERE t.anio = :anio"),
    @NamedQuery(name = "Taxi.findByEmpresa", query = "SELECT t FROM Taxi t WHERE t.empresa = :empresa")})
public class Taxi implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "nTaxi")
    private Integer nTaxi;
    @Basic(optional = false)
    @Column(name = "kmLt")
    private double kmLt;
    @Column(name = "nombreConductor")
    private String nombreConductor;
    @Column(name = "modeloUnidad")
    private String modeloUnidad;
    @Column(name = "anio")
    private Integer anio;
    @JoinColumn(name = "id_empresa", referencedColumnName = "id")
    @ManyToOne
    private Empresa empresa;

    public Taxi() {
    }

    public Taxi(Integer nTaxi) {
        this.nTaxi = nTaxi;
    }

    public Taxi(Integer nTaxi, double kmLt) {
        this.nTaxi = nTaxi;
        this.kmLt = kmLt;
    }

    public Integer getNTaxi() {
        return nTaxi;
    }

    public void setNTaxi(Integer nTaxi) {
        this.nTaxi = nTaxi;
    }

    public double getKmLt() {
        return kmLt;
    }

    public void setKmLt(double kmLt) {
        this.kmLt = kmLt;
    }

    public String getNombreConductor() {
        return nombreConductor;
    }

    public void setNombreConductor(String nombreConductor) {
        this.nombreConductor = nombreConductor;
    }

    public String getModeloUnidad() {
        return modeloUnidad;
    }

    public void setModeloUnidad(String modeloUnidad) {
        this.modeloUnidad = modeloUnidad;
    }

    public Integer getAnio() {
        return anio;
    }

    public void setAnio(Integer anio) {
        this.anio = anio;
    }

    public Empresa getEmpresa() {
        return empresa;
    }

    public void setEmpresa(Empresa empresa) {
        this.empresa = empresa;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nTaxi != null ? nTaxi.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Taxi)) {
            return false;
        }
        Taxi other = (Taxi) object;
        if ((this.nTaxi == null && other.nTaxi != null) || (this.nTaxi != null && !this.nTaxi.equals(other.nTaxi))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Taxi[nTaxi=" + nTaxi + "]";
    }
}
